For anyone intrested this is how I SOLVED the problem with this XSLT Extension
[code]
///
/// Gets the current page templateAlias assigned to it
///
/// Pass in the currentpage TemplateID
///
public string GetTemplateAliasFromID(int templateID)
{
string templateAlias = string.Empty;
Template umbracoTemplate = umbraco.cms.businesslogic.template.Template.GetTemplate(templateID);
if (umbracoTemplate != null) templateAlias = umbracoTemplate.Alias;
Testing against active template name? [SOLVED]
Hello all I need to test against the current template that is being used by a page so I can apply some different logic to the page.
But testing against @template only gives the template ID which will be different in DEV to the ID of the template in PRODUCTION.
Is there anyway to test against the templateAlias instead?
Thanks,
Warren
Comment author was deleted
First thought:
You could create an xslt extension that takes the template id and returns the template alias.
Is that the only way to do it you think with an extension?
Or, use this in your template:
<%= umbraco.cms.businesslogic.template.Template.GetByAlias("") %> and pass that as a param into macro that references the xslt.
(Haven't done that yet, but would be surprised if that didn't work)
Xslt extension would use the same code...
Regards,
/Dirk
Thats wicked Dirk so does that return the int for that template alias?
For anyone intrested this is how I SOLVED the problem with this XSLT Extension
[code]
///
/// Gets the current page templateAlias assigned to it
///
/// Pass in the currentpage TemplateID
///
public string GetTemplateAliasFromID(int templateID)
{
string templateAlias = string.Empty;
Template umbracoTemplate = umbraco.cms.businesslogic.template.Template.GetTemplate(templateID);
if (umbracoTemplate != null) templateAlias = umbracoTemplate.Alias;
return templateAlias;
}
[/code]
Here is an associated XSLT snippet as well.
[code]
[/code]
is working on a reply...